package com.study.ming.feign;

import com.study.ming.feign.fallback.WeatherFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author yh
 * @date 2022/10/27 16:39
 **/
@Component
@FeignClient(name="weather", fallbackFactory = WeatherFallbackFactory.class)
public interface WeatherService {
    /**
     * 查询
     *    以下方法名和参数都需要和服务提供者者保持一致，@GetMapping中的就是服务提供者对应的全路径
     * @return
     */
    @GetMapping("/getByCity")
    public String getByCity(@RequestParam(name="id", value = "id", required = false, defaultValue = "1") Integer id);
}
